" MoinMoin structured text syntax file
" Filename:	moin.vim
" Language:	MoinMoin structured text
" Maintainer: Gustavo Niemeyer <niemeyer@conectiva.com>
" Last Change: Wed, 26 Jun 2002 21:31:09 -0300

" remove any old syntax stuff hanging around
if version < 600
  syntax clear
elseif exists("b:current_syntax")
  finish
endif

syn sync lines=30

syn region  moinSettings    start="\%^@ \(WARNING\|Using\)" end="^[^@]"me=e-1 end="^$" 
syn region  moinItalic      start="''" end="''"
syn region  moinBold        start="'''" end="'''"
syn region  moinCode        start="{{{" end="}}}"
syn match   moinComment     "^##.*$"
syn region  moinMacro       start="\[\[" end="\]\]"
syn region  moinHeader      start="^\z(==\{1,4}\) " end=" \z1$" oneline
syn match   moinTableOpt    "||<[^>]*>"hs=s+2 contained
syn region  moinTable       start="^||" end="||$" oneline contains=moinTableOpt
syn match   moinRule        "^-\{4,}$"
syn match   moinSmileys     "\(\s\|\_^\)\(:)\|B:\|:))\|;)\|:D\|<:(\|X-(\|:O\|:(\|/!\\\|<!>\|(!)\|:?\|:\\\|>:>\|%)\|@)\||)\|;))\|(./)\|{OK}\|{X}\|{i}\|{1}\|{2}\|{3}\)\(\s\|\_$\)"
syn match   moinLinkMoin    "\(/\?[[:upper:]][[:lower:][:digit:]]\+\)\{2,}"
syn match   moinLinkEmail   "<\?[[:alnum:]-._+]\+@[[:alnum:]-]\+\.[[:alnum:]-.]\+>\?"
syn match   moinLinkUrl     "\(http\|https\|ftp\|nntp\|news\|mailto\|telnet\|wiki\|file\|attachment\|inline\|drawing\):\([^][:space:]<"'}|:,.)?!]\|[]"'}|:,.)?!][^][:space:]<"'}|:,.)?!]\)\+"
syn match   moinLinkBUrl    "\[\(\(http\|https\|ftp\|nntp\|news\|mailto\|telnet\|wiki\|file\|attachment\|inline\|drawing\):\([^][:space:]<"'}|:,.)?!]\|[]"'}|:,.)?!][^][:space:]<"'}|:,.)?!]\)\+\|#\)[^][:space:]]\+\(\s[^]]\+\)\?\]"
syn match   moinLinkQUrl    "\[\"[^]]\+\"\]"
syn match   moinLinkInter   "[A-Z][a-zA-Z]\+:[^[:space:]'\":<]\([^][:space:]<"'}|:,.)?!]\|[]"'}|:,.)?!][^][:space:]<"'}|:,.)?!]\)\+"

if !exists("did_dic_syntax_inits")
  let did_dic_syntax_inits = 1
  hi link moinComment    Comment
  hi def  moinBold       term=bold cterm=bold gui=bold
  hi def  moinItalic     term=italic cterm=italic gui=italic
  hi def  moinSettings   ctermfg=green guifg=green
  hi link moinMacro      Macro
  hi link moinHeader     Title
  hi def  moinTable      ctermfg=yellow guifg=yellow
  hi def  moinTableOpt   ctermfg=green guifg=green
  hi link moinRule       Title
  hi def  moinCode       ctermfg=cyan guifg=cyan
  hi def  moinLink       ctermfg=red guifg=red
  hi link moinLinkMoin   moinLink
  hi link moinLinkEmail  moinLink
  hi link moinLinkUrl    moinLink
  hi link moinLinkBUrl   moinLinkUrl
  hi link moinLinkQUrl   moinLinkUrl
  hi link moinLinkInter  moinLink
  hi def  moinSmileys    ctermfg=yellow guifg=yellow
endif

let b:current_syntax = "moin"

